﻿using System;
using System.Globalization;

namespace HospitalManager.QuanLyTiepNhan.TiepNhanBenhNhan
{
    public partial class DanhSachBenhNhanTiepNhan : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack) return;
            if (Session["username"] == null)
            {
                Response.RedirectToRoute("DangNhap");
            }
            LoadPage();
        }

        protected void Page_PreRender(object sender, EventArgs e)
        {
            ViewState["CheckRefresh"] = Session["CheckRefresh"];
        }

        private void LoadPage()
        {
            Session["CheckRefresh"] = Server.UrlEncode(DateTime.Now.ToString(CultureInfo.InvariantCulture));
        }

        protected void btnTimKiem_Click(object sender, EventArgs e)
        {

        }

        protected void btnThemMoi_Click(object sender, EventArgs e)
        {
            if (Session["username"] == null)
            {
                Response.RedirectToRoute("DangNhap");
            }
            else
            {
                if (Session["CheckRefresh"].ToString() != ViewState["CheckRefresh"].ToString())
                {
                    LoadPage();
                }
                else
                {
                    Response.Redirect("ThongTinBenhNhan.aspx");
                }
            }
        }
    }
}